Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a comma separated string with some properties I want from the childNodes of the currentPage.
<xsl:for-each select="$currentPage/* [...]"> <xsl:variable name="split" select="umbraco.library:Split($properties, ',')"/> <xsl:variable name="node" select="."/> <xsl:for-each select="$split/value"> <xsl:value-of select="$node/."/> </xsl:for-each></xsl:for-each>
The above code returns 3 times the last propery from properties.
So ... How do I write $node/data [@alias=$split] in the new 4.5 schema?$node/$split gives an error
Hi Bram,
This might work
<xsl:value-of select="$node/*[name() = .]"/>
Matt
If not, maybe try putting the current value in a var first
<xsl:variable name="myVar" select="." /><xsl:value-of select="$node/*[name() = $myVar]"/>
hmm, thought you solutions would be right Matt, but none of them return a value,but $node and $MyVar do
What values do you get when you output $node and $MyVar
try this:
<xsl:value-of select="$node/*[name() = current()]" />
Here's the complete script I tried:
<xsl:variable name="properties" select="'prop1,prop2'" /> <xsl:for-each select="$currentPage/*"> <xsl:value-of select="./@nodeName" /><br /> <xsl:variable name="split" select="umbraco.library:Split($properties, ',')" /> <xsl:variable name="node" select="." /> <textarea style="width: 300px;height: 200px;"><xsl:copy-of select="." /></textarea><br /> <xsl:for-each select="$split/value"> Property: <xsl:value-of select="current()" /><br /> Value: <xsl:value-of select="$node/*[name() = current()]" /> <br /> </xsl:for-each> </xsl:for-each>
Just thought that might come in handy sometime. ;) Hope it works for you,Sascha
for one reason I always get the same value for $node
when I make a new xslt file it's ok, I suppose it has something to do with the fact that I use it to make an xml-file
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How to write $node/data [@alias=$split] in 4.5 schema?
I have a comma separated string with some properties I want from the childNodes of the currentPage.
The above code returns 3 times the last propery from properties.
So ... How do I write $node/data [@alias=$split] in the new 4.5 schema?
$node/$split gives an error
Hi Bram,
This might work
Matt
If not, maybe try putting the current value in a var first
Matt
hmm, thought you solutions would be right Matt, but none of them return a value,
but $node and $MyVar do
Hi Bram,
What values do you get when you output $node and $MyVar
Matt
Hi Bram,
try this:
Here's the complete script I tried:
Just thought that might come in handy sometime. ;) Hope it works for you,
Sascha
for one reason I always get the same value for $node
when I make a new xslt file it's ok, I suppose it has something to do with the fact that I use it to make an xml-file
is working on a reply...